#ifndef _COMMON_H_
#define _COMMON_H_
#include <sys/types.h>

#define TYPE_LEN 32
#define MOUNT_POINT_LEN 32
#define MODEL_LEN 40     /* specified in <linux/hdreg.h> structure: hd_driveid */
#define SERIAL_LEN 20    /* specified in <linux/hdreg.h> structure: hd_driveid */
#define FIRMWARE_LEN 8   /* specified in <linux/hdreg.h> structure: hd_driveid */
#define PARTITION_NUM 12
#define DISK_NUM 12
#define MAGIC_LEN 16
#define MAGIC "eholsialtlbupbyg"
struct partition
{
	char type[TYPE_LEN]; /* type of file system */
	char mount_point[MOUNT_POINT_LEN]; /* mount point of this partition */
	u_int32_t total; /* total space of this partition (G) */
	u_int32_t used; /* space used (G)*/
	u_int32_t free; /* space available (G) */
}  __attribute__((packed));

struct disk
{
	char model[MODEL_LEN]; /* model number of the disk */
	char serial[SERIAL_LEN]; /* serial number of the disk */
	char firmware[FIRMWARE_LEN]; /* firmware revistion of the disk */
}  __attribute__((packed));

struct system_info
{
	char magic[MAGIC_LEN]; /* to avoid attack */
	u_int32_t version; /* the current version is 4, as of this writing */
	u_int32_t av1;  /* come from top load avarage (x)/100 */
	u_int32_t av5;  /* come from top load avarage (x)/100 */
	u_int32_t av15; /* come from top load avarage (x)/100 */
	/* come from top second line */
	u_int32_t task_total; 
	u_int32_t task_run;
	u_int32_t task_sleep;
	u_int32_t task_stop;
	u_int32_t task_zombile;
	/* come from top third line, (x)/10000 */
	u_int32_t us; 
	u_int32_t ni;
	u_int32_t sy;
	u_int32_t id;
	u_int32_t wa;
	u_int32_t hi;
	u_int32_t si;
	u_int32_t st;
	/* come from top fourth line */
	u_int32_t mem_tt; /* memory total (k) */
	u_int32_t mem_us; /* memory used  (k) */
	u_int32_t mem_fr; /* memory free  (k) */
	u_int32_t mem_bu; /* memory buffer(k) */
	u_int32_t np; /* number of partitions in p[] */
	u_int32_t nd; /* number of disks in d[] */
	u_int32_t reserved;
	struct partition p[PARTITION_NUM];
	struct disk d[DISK_NUM];
}  __attribute__((packed));


#endif
